﻿using System;
using OpenQA.Selenium;

namespace Selenium.PageToolkit.ControlFactoryChainImpl
{
    internal class WebElementFactory : ChainBase<PageElementAttribute>
    {
        protected override object Inject(Type fieldType, PageElementAttribute attribute, LambdaPageFactory factory)
        {
            if (!fieldType.IsAssignableFrom(typeof(IWebElement)))
                return null;
            return factory.CreateWebElement(attribute.Spec());
        }

    }
}